<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ page contentType="text/html;charset=UTF-8" %>
<%@page import="com.lmpop.trade.ti_emaillist.*" %>
<%@page import="java.util.*" %>
<%@page import="com.lmpop.frame.util.PageTools" %>
<%@page import="com.lmpop.trade.ti_member.*" %>
<%@page import="com.lmpop.trade.ti_admin.*" %>
<%
	request.setCharacterEncoding("UTF-8");
	Map ti_emaillist = new Hashtable();
	String s_title= "";
	if(request.getParameter("search_title")!=null && !request.getParameter("search_title").equals("")){
		s_title = request.getParameter("search_title");
		ti_emaillist.put("title",s_title);
	}
	String s_is_repeat= "";
	if(request.getParameter("search_is_repeat")!=null && !request.getParameter("search_is_repeat").equals("")){
		s_is_repeat = request.getParameter("search_is_repeat");
		ti_emaillist.put("is_repeat",s_is_repeat);
	}
	String end_date = "";
	if(request.getParameter("txtEndDate")!=null && !request.getParameter("txtEndDate").equals("")){
		end_date = request.getParameter("txtEndDate");
		ti_emaillist.put("end_date",end_date);
	}	
	String start_date = "";
	if(request.getParameter("txtStartDate")!=null && !request.getParameter("txtStartDate").equals("")){
		start_date = request.getParameter("txtStartDate");
		ti_emaillist.put("start_date",start_date);
	}	
   // out.println(ti_emaillist);	
	Ti_memberInfo userInfo = new Ti_memberInfo();
	Ti_adminInfo admininfo =new Ti_adminInfo();
	
	Ti_emaillistInfo ti_emaillistInfo = new Ti_emaillistInfo();
	String iStart = "0";
	int limit = 20;
	if(request.getParameter("iStart")!=null) iStart = request.getParameter("iStart");
	List list = ti_emaillistInfo.getListByPage(ti_emaillist,Integer.parseInt(iStart),limit);
	int counter = ti_emaillistInfo.getCountByObj(ti_emaillist);
	String pageString = new PageTools().getGoogleToolsBar(counter,"index.jsp?search_title="+s_title+"&search_is_repeat="+s_is_repeat+"&txtEndDate="+end_date+"txtStartDate"+start_date+"&iStart=",Integer.parseInt(iStart),limit);
%>



<html>
  <head>
    
    <title>邮件发送管理</title>
	<link href="/program/admin/index/css/style.css" rel="stylesheet" type="text/css">
	<script type="text/javascript" src="/js/commen.js"></script>
	<script type="text/javascript" src="emailtem.js"></script>
	<script type="text/javascript" src="js_commen.js"></script>
	<script language="javascript" type="text/javascript" src="/program/plugins/calendar/WdatePicker.js"></script>
</head>

<body>
	<table width="100%" cellpadding="0" cellspacing="0" border="0">
		<tr>
			<td width="90%">
				<h1>邮件发送管理</h1>
			</td>
			<td>
				<a href="addInfo.jsp"><img src="/program/admin/index/images/post.gif" /></a>
			</td>
		</tr>
	</table>
	
	<form action="index.jsp" name="indexForm" method="post">
	
	<table width="100%" class="dl_su" cellpadding="0" cellspacing="0" >
		<tr>
			<td align="left" >
			
			<td align="left" >
			邮件标题:<input name="search_title" id="search_title" type="text" />
			
			
			
			是否重发:
				<select class="input" name="search_is_repeat" id="search_tem_type" >
					<option value="">请选择</option>
					<option value="0">是</option>
					<option value="1">否</option>
			   </select>
			
			
			
				&nbsp;按预约时间段选择: 
			 <input name="txtStartDate" type="text" id="txtStartDate" class="Wdate" value="" onClick="WdatePicker({maxDate:'#F{$dp.$D(\'txtEndDate\',{d:-1})}',readOnly:true})" size="15" />
					- 
			<input name="txtEndDate" id="txtEndDate" type="text" class="Wdate" value="" onClick="WdatePicker({minDate:'#F{$dp.$D(\'txtStartDate\',{d:1})}',readOnly:true})" size="15"/>
			
			<input name="searchInfo" type="button" onClick="return search()" value="查询"/>	
			</td>
		</tr>
	</table>

	<table width="100%" cellpadding="0"  class="tablehe"  cellspacing="0" border="0">
		<tr><td><%=pageString %></td></tr>
	</table>
	
	<% 
		int listsize = 0;
		if(list!=null && list.size()>0){
			listsize = list.size();
	%>
	
	<table width="100%" class="dl_bg" cellpadding="0"  cellspacing="0" border="0">
		<tr>
			<td width="90%">
				<input type="button" name="delInfo" onClick="delIndexInfo()" value="删除" class="buttab"/>
			</td>
			<td >
				总计:<%=counter %>条
			</td>
		</tr>
	</table>
	
	<table width="100%" cellpadding="1" cellspacing="1" class="listtab" border="0">
		<tr>
			<th width="5%" align="center"><input type="checkbox" name="checkall" id="checkall" onClick="selectAll()"></th>
			
		  	
		  	<th width="10%">重复发送</th>
		  	
		  	<th>邮件标题</th>
		  	
		  	<th width="20%">预约时间</th>
		  	
		  	<th width="10%">操作人</th>
		  	
				<th width="10%">修改</th>
	  		<th width="10%">删除</th>
		</tr>
		
		
		<% 
		  		for(int i=0;i<list.size();i++){
		  			Hashtable map = (Hashtable)list.get(i);
		  			String send_id="",cust_id="",send_state="",is_repeat="",title="",content="",pre_date="",send_date="",user_id="",remark="",user_name="";
		  			  	if(map.get("send_id")!=null) send_id = map.get("send_id").toString();
  	                    if(map.get("cust_id")!=null) cust_id = map.get("cust_id").toString();
  	                    if(map.get("user_id")!=null) user_id = map.get("user_id").toString();
  	                    if(map.get("send_state")!=null) send_state = map.get("send_state").toString();
  	                    if(map.get("is_repeat")!=null) is_repeat = map.get("is_repeat").toString();
  	                    if(map.get("title")!=null) title = map.get("title").toString();
  	                    if(map.get("content")!=null) content = map.get("content").toString();
  	                    if(map.get("pre_date")!=null) pre_date = map.get("pre_date").toString();
                        if(pre_date.length()>19)pre_date=pre_date.substring(0,19);
  	                    if(map.get("send_date")!=null) send_date = map.get("send_date").toString();
                        if(send_date.length()>19)send_date=send_date.substring(0,19);
	                    
	                    user_name = userInfo.getCustNameByPk(cust_id);
	                  //  user_name = admininfo.getUserNameByPK(user_id);
	                    if("".equals(user_name)||user_name.length()==0){
	                              user_name = admininfo.getUserNameByPK(user_id);
	                    }
  	if(map.get("remark")!=null) remark = map.get("remark").toString();

		  %>
		
		<tr>
			<td width="5%" align="center"><input type="checkbox" name="checkone<%=i %>" id="checkone<%=i %>" value="<%=send_id %>" /></td>
			
		  	
		  	<td>
			<%
			if(is_repeat.equals("0")){
			%>
			是
			<%
			}else {
			%>
			否
			<%
			}
			%>
			</td>
		  	
		  	<td><%=title%></td>
		  	
		  	<td><%=pre_date%></td>
		  	
		  	<td><%=user_name%></td>
		  	
			<td width="10%"><a href="updateInfo.jsp?send_id=<%=send_id %>"><img src="/program/admin/images/edit.gif" title="修改" /></a></td>
	  		<td width="10%"><a href="javascript:delOption('<%=send_id%>','7301')"><img src="/program/admin/images/delete.gif" title="删除" /></a></td>
		</tr>
		
		  <%
		  		}
		  %>
		
	</table>
	
	<table width="100%" class="dl_bg" cellpadding="0"  cellspacing="0" border="0">
		<tr>
			<td width="90%">
				<input type="button" name="delInfo" onClick="delIndexInfo()" value="删除" class="buttab"/>
			</td>
			<td >
				总计:<%=counter %>条
			</td>
		</tr>
	</table>
	<table width="100%" cellpadding="0" cellspacing="0" border="0" class="tablehe">
		<tr><td><%=pageString %></td></tr>
	</table>
	
	<%
		 }
	%>
	
	  <input type="hidden" name="listsize" id="listsize" value="<%=listsize %>" />
	  <input type="hidden" name="pkid" id="pkid" value="" />
	  <input type="hidden" name="bpm_id" id="bpm_id" value="7301" />
	  </form>
</body>

</html>
